package com.itheima.d3_inner_class3.CaseTest2;

/**
 * @ClassName Test2
 * @Author 16799
 * @Date 2025/7/12 21:05
 * @Version 1.0
 * @Description TODO
 **/
public class Test2 {
    public static void main(String[] args) {
        /*//写法一，匿名内部类
        swimming swimming = new swimming() {
            @Override
            public void swim() {
                System.out.println("狗🏊‍飞快~~~~");
            }
        };

        go(swimming);*/

        //写法二，简略
        go(new swimming() {
            @Override
            public void swim() {
                System.out.println("狗跑得快");
            }
        });


    }
    public static void go(swimming s){
        System.out.println("开始-----------------------");
        s.swim();
    }
}

interface swimming{
    void swim();
}
